package com.hyc.controller;

import cn.hutool.http.HttpUtil;
import com.hyc.SignUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.TreeMap;

@RestController
public class LoginController {

    @RequestMapping("login")
    public String login(String name,String pass) {
        TreeMap<String, Object> paramMap = new TreeMap<>();
        paramMap.put("name", "hyc");
        paramMap.put("pass", "123456");
        paramMap.put("timestamp", System.currentTimeMillis());
        String sign = SignUtil.sign(paramMap, "123456");
        paramMap.put("sign", sign);
        String result= HttpUtil.post("http://localhost:8080/login", paramMap);

        return result;
    }
}
